]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Rely on tecla to figure out the current layout
authorSebastian Wick <sebastian.wick@redhat.com>
Mon, 10 Feb 2025 16:00:48 +0000 (17:00 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 13 Feb 2025 03:58:23 +0000 (03:58 +0000)
Tecla shows the current layout, and keeps track of layout changes, if no
arguments are passed to it. This is exactly the behavior we want for the
"Show Keyboard Layout" button.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3635>

js/ui/status/keyboard.js

index a09af32b1edcda7a993d39381d968109c8796fbb..1b43e10519564d535da36d3b55192300beb39f76 100644 (file)
@@ -1104,35 +1104,6 @@ class InputSourceIndicator extends PanelMenu.Button {
     _showLayout() {
         Main.overview.hide();
 
-        let source = this._inputSourceManager.currentSource;
-        let xkbLayout = '';
-        let xkbVariant = '';
-
-        if (source.type === INPUT_SOURCE_TYPE_XKB) {
-            [, , , xkbLayout, xkbVariant] = KeyboardManager.getXkbInfo().get_layout_info(source.id);
-        } else if (source.type === INPUT_SOURCE_TYPE_IBUS) {
-            let engineDesc = IBusManager.getIBusManager().getEngineDesc(source.id);
-            if (engineDesc) {
-                xkbLayout = engineDesc.get_layout();
-                xkbVariant = engineDesc.get_layout_variant();
-            }
-
-            // The `default` layout from ibus engine means to
-            // use the current keyboard layout.
-            if (xkbLayout === 'default') {
-                const current = this._inputSourceManager.keyboardManager.currentLayout;
-                xkbLayout = current.layout;
-                xkbVariant = current.variant;
-            }
-        }
-
-        if (!xkbLayout || xkbLayout.length === 0)
-            return;
-
-        let description = xkbLayout;
-        if (xkbVariant.length > 0)
-            description = `${description}+${xkbVariant}`;
-
-        Util.spawn(['tecla', description]);
+        Util.spawn(['tecla']);
     }
 });